<?php
    include_once './config.php';
    require_once './vendor/autoload.php';
    use Symfony\Component\HttpFoundation\File\UploadedFile;
    $file = new UploadedFile($_FILES['file']['tmp_name'], $_FILES['file']['name']);
    $targetDir = 'uploads/';
    $fileName = uniqid('', true) . '.' . $file->getClientOriginalExtension();
    $file->move($targetDir, $fileName);
    $data['src'] = $targetDir.$fileName;
    echo json_encode(['code'=>1,'msg'=>"上传成功",'data'=>$data]);
?>